<template>
	<view id="tmpl">
		<!-- <hd-message-bar :index='1' @on_change="OnChange"></hd-message-bar> -->
		<view style="margin-top: 15px;">
			<view class="list" v-for="(item,index) in news ">
				<view class="item">
					<view class="thumb">
						<!-- <image src="../../static/image/test/new-thumb.png" mode="aspectFill" /> -->
					</view>
					<view class="detial">
						<view class="top">
							<view class="info">
								<text class="class_name">{{item.tgTitle}}</text>
							</view>
							<view class="date">
								<text>{{item.createTime}}</text>
							</view>
						</view>
						<view class="description" v-html="item.tgContent"></view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				news: [],
			}
		},
		methods: {
			onLoad: function() {
				this.$_if.Initialize(this);
				let _this = this;
				this.$_if.Initialize(this);
				let url = "/"+_this.pageNum+"/"+ _this.pageSize;
				this.$api.tglist(url).then((res) => {
					_this.news = res.data.rows;
				})
			},
			scrollDownPage: function() {
				let _this = this;
				this.pageNum += 1;
				this.$api.tglist({
					pageNum: _this.pageNum,
					pageSize: _this.pageSize,
				}).then((res) => {
					_this.news = res.data.rows
					_this.news.push(res.data.rows)
				})
			},
			onShow: function() {},
			OnChange(item) {
				this.GoToPage('message', item.url);
			}
		}
	}
</script>

<style lang="scss" scoped>
	page {
		background-color: $background-color-2;
	}

	.list {
		&:nth-child(1) {
			// padding-top: 80upx;
		}

		.item {
			margin-top: 10upx;
			background-color: $background-color-1;
			padding: 20upx 30upx;
			@extend .flex-between;

			.thumb {
				flex-grow: 1;

				image {
					@extend .image-radis;
					width: 95upx;
					height: 95upx;
				}
			}

			.detial {
				margin-left: 20upx;
				flex-grow: 1;

				.top {
					@extend .flex-between;
					border-bottom: solid 1px rgba(66, 66, 66, .3);
					padding: 10upx 0;
					padding-top: 0;
				}
			}

			.info {
				font-size: $font-size-title;

				.class_name {}

				.nickname {
					margin-left: 10upx;
				}
			}

			.date {
				font-size: $uni-font-size-base;
				color: $font-color-4;
			}

			.description {
				font-size: $uni-font-size-base;
				color: $font-color-2;
				padding-top: 10upx;
				line-height: 40upx;
				height: 40upx;
				overflow: hidden;
			}
		}
	}
</style>
